package com.ruixi.utils;

import com.ruixi.exception.ErrorCode;
import com.ruixi.exception.PayException;

/**
 * @author lrzg
 * @date 2021-05-12 16:13
 * @Description TODO
 */
public class AssertUtils {

    /**
     * 判断是否空
     * @param object
     * @param errorCode
     * @throws PayException
     */
    public static void isNotNull(Object object, ErrorCode errorCode) throws PayException {
        if (object == null) {
            throw new PayException(errorCode);
        }
    }
    /**
     * 判断真
     * @param expression
     * @param errorCode
     * @throws PayException
     */
    public static void isTrue(boolean expression, ErrorCode errorCode) throws PayException {
        if (!expression) {
            throw new PayException(errorCode);
        }
    }
}
